// Fig. 24.21: MessageListener.java
// MessageListener is an interface for classes that wish to
// receive new chat messages.
package Client;

import GUI.panelChat1;
import javax.swing.SwingUtilities;


public class MyMessageListener implements MessageListener
   {

    private panelChat1 painel;
    public MyMessageListener(panelChat1 panel) {

        painel = panel;

    }
    // when received, display new messages in messageArea
      public void messageReceived( String from, String message )
      {
         // append message using MessageDisplayer
         SwingUtilities.invokeLater( 
            new MessageDisplayer( from, message, painel ) );
      } // end method messageReceived
   } // end MyMessageListener inner class

